package com.zkthink.ceres.order.enums;

import com.zkthink.ceres.order.entity.Order;
import lombok.Getter;

/** 订单状态枚举类
 * 1-待付款 2-待发货，无退款流程 3-待发货，有退款流程 4-待收货，无退货流程 5-待收货，有退货流程 6-已完成 7-已取消
 * @author JustArgo 2020/5/11 22:44
 * @return
 */
@Getter
public enum OrderStatusEnum {

    NO_PAY(1,"待付款"),
    NO_SEND(2,"待发货"),
    NO_RECEIVE(3,"待收货"),
    FINISH(4,"已完成"),
    CANCELED(5,"已取消")
    ;

    private int code;

    private String desc;

    OrderStatusEnum(int code, String desc){
        this.code = code;
        this.desc = desc;
    }

    public static OrderStatusEnum findByCode(int code){
        OrderStatusEnum[] values = values();
        for(OrderStatusEnum statusEnum:values){
            if(statusEnum.getCode()==code){
                return statusEnum;
            }
        }
        return null;
    }

}
